| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Lines | 12 |
| Ratio | 100 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | View Code Duplication | var mongoose = require('mongoose') |
|
| 12 | invoiceSchema.pre('save', function (next) { |
||
| 13 | let overallTotal = 0.00 |
||
| 14 | // let overallVat |
||
| 15 | // All the items should give the total |
||
| 16 | for (let item in this.items) { |
||
| 17 | overallTotal += item.total |
||
| 18 | // overallVat += item.subTotal * item.vatRate |
||
| 19 | } |
||
| 20 | |||
| 21 | this.total = overallTotal |
||
| 22 | next() |
||
| 23 | }) |
||
| 24 | |||
| 26 |